		TITLE	CVLIBRAR - Copyright (c) SLR Systems 1994

		INCLUDE	MACROS
		INCLUDE	LIBRARY
		INCLUDE	IO_STRUC

		PUBLIC	CV_LIBRARIES


		.DATA

		EXTERNDEF	CV_TEMP_RECORD:BYTE

		EXTERNDEF	MAX_LIBNUM:DWORD,CURNMOD_NUMBER:DWORD,CV_LIBRARY_TYPE:DWORD,BYTES_SO_FAR:DWORD
		EXTERNDEF	FIRST_CV_LIB_GINDEX:DWORD

		EXTERNDEF	LIBRARY_GARRAY:STD_PTR_S

		EXTERNDEF	CV_DWORD_ALIGN:DWORD


		.CODE	PASS2_TEXT

		EXTERNDEF	HANDLE_CV_INDEX:PROC,_xdebug_write:proc,_move_file_list_gindex_nfn:proc


CV_LIB_VARS	STRUC

MY_FILNAM_BP	NFN_STRUCT	<>

CV_LIB_VARS	ENDS


FIX	MACRO	X

X	EQU	([EBP - SIZE CV_LIB_VARS].(X&_BP))

		ENDM


FIX	MY_FILNAM


CV_LIBRARIES	PROC
		;
		;OUTPUT LIST OF LIBRARY NAMES USED IN INDEX ORDER...
		;
		CALL	CV_DWORD_ALIGN

		MOV	EAX,FIRST_CV_LIB_GINDEX
		XOR	ECX,ECX

		TEST	EAX,EAX
		JZ	L9$

		PUSHM	EBP,EDI,ESI,EBX

		MOV	EBP,ESP
		SUB	ESP,SIZE CV_LIB_VARS
		ASSUME	EBP:PTR CV_LIB_VARS

		MOV	EDI,OFF CV_TEMP_RECORD+1
		MOV	ESI,EAX

		MOV	EAX,BYTES_SO_FAR

		PUSH	EAX
		MOV	[EDI-1],CL			;FIRST IS NUL
L1$:
		CONVERT	ESI,ESI,LIBRARY_GARRAY
		ASSUME	ESI:PTR LIBRARY_STRUCT

		MOV	EAX,[ESI]._LS_NEXT_CV_GINDEX

		PUSH	EAX
		CALL	DO_LIBRARY

		POP	ESI
		MOV	EDI,OFF CV_TEMP_RECORD

		TEST	ESI,ESI
		JNZ	L1$

		MOV	CURNMOD_NUMBER,-1
		BITT	CV_4_TYPE
		JNZ	L2$
		INC	CURNMOD_NUMBER
L2$:
		;
		;NOW, DO INDEX ENTRY
		;
		POP	EAX
		MOV	ECX,CV_LIBRARY_TYPE

		CALL	HANDLE_CV_INDEX

		CALL	CV_DWORD_ALIGN

		MOV	ESP,EBP

		POPM	EBX,ESI,EDI,EBP
L9$:
		RET

CV_LIBRARIES	ENDP


DO_LIBRARY	PROC	NEAR	PRIVATE
		;
		;DX IS LIBRARY # TO FIND, SAVE DX AND CX
		;
		;FOUND LIBRARY, NOW OUTPUT NAME TEXT PLEASE
		;
		MOV	ECX,[ESI]._LS_FILE_LIST_GINDEX
		LEA	EAX,MY_FILNAM

		push	ECX
		push	EAX
		call	_move_file_list_gindex_nfn	;STICKS IN SEARCH PATH IF THERE WAS ONE
		add	ESP,8

		MOV	ECX,MY_FILNAM.NFN_TOTAL_LENGTH
		LEA	ESI,MY_FILNAM.NFN_TEXT

		MOV	[EDI],CL
		INC	EDI

		AND	ECX,0FFH			;JUST IN CASE

		REP	MOVSB

		push	EDI
		call	_xdebug_write
		add	ESP,4
		ret

DO_LIBRARY	ENDP


		END

